Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement Decipher model in external #3015

Merged
merged 51 commits into from
Nov 13, 2024
Merged

feat: implement Decipher model in external #3015

merged 51 commits into from
Nov 13, 2024

Conversation

justjhong
Copy link
Contributor

CC @ANazaret

Implements Decipher model (https://github.com/azizilab/decipher, https://www.biorxiv.org/content/10.1101/2023.11.11.566719v1) into external/

For now, it only includes base implementation without many of the downstream workflows from the original implementation.
Includes minor non-breaking changes to the LowLevelPyroTrainingPlan.

Test: was able to approximately reproduce figures from the tutorial (https://github.com/azizilab/decipher/blob/main/examples/1-tutorial.ipynb), some of the v plots for several random seeds below:

Original implementation:
decipher_orig_0
decipher_orig_1030

New implementation:
decipher_tutorial_scvi_0
decipher_tutorial_scvi_1
decipher_tutorial_scvi_2
decipher_tutorial_scvi_3

@justjhong justjhong added the cuda tests Run test suite on CUDA label Oct 15, 2024
Copy link

codecov bot commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 97.62846% with 6 lines in your changes missing coverage. Please review.

Project coverage is 84.58%. Comparing base (2046e7c) to head (d8c5ac4).
Report is 20 commits behind head on main.

Files with missing lines Patch % Lines
src/scvi/external/decipher/_components.py 91.48% 4 Missing ⚠️
src/scvi/external/decipher/_trainingplan.py 97.10% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3015      +/-   ##
==========================================
+ Coverage   84.30%   84.58%   +0.27%     
==========================================
  Files         173      178       +5     
  Lines       14795    15048     +253     
==========================================
+ Hits        12473    12728     +255     
+ Misses       2322     2320       -2     
Files with missing lines Coverage Δ
src/scvi/external/__init__.py 100.00% <100.00%> (ø)
src/scvi/external/decipher/__init__.py 100.00% <100.00%> (ø)
src/scvi/external/decipher/_model.py 100.00% <100.00%> (ø)
src/scvi/external/decipher/_module.py 100.00% <100.00%> (ø)
src/scvi/external/decipher/_trainingplan.py 97.10% <97.10%> (ø)
src/scvi/external/decipher/_components.py 91.48% <91.48%> (ø)

... and 3 files with indirect coverage changes


# The multiple outputs are computed as a single output layer, and then split
indices = np.concatenate(([0], np.cumsum(self.output_dims)))
self.output_slices = [slice(s, e) for s, e in zip(indices[:-1], indices[1:], strict=False)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this produces slices along the output, which will just be a concatenated version of all outputs needed, so that the output can be separated by the provided input_dims. It's a bit tricky, but I think the comment above serves the purpose

"""
return torch.optim.Adam([self._dummy_param])

def optimizer_step(self, *args, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these missing from LowLevelPyroTrainingPlan? Should we add them there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are only in the PyroTrainingPlan, not the LowLevelPyroTrainingPlan. Whether we want to push it back into the low-level class is up to you

@justjhong justjhong requested a review from canergen November 13, 2024 01:31
@canergen canergen changed the title Implement Decipher model in external feat: implement Decipher model in external Nov 13, 2024
Copy link
Member

@canergen canergen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide more information on what context means and how to use it in the user guide.

@justjhong justjhong removed the on-merge: backport to 1.2.x on-merge: backport to 1.2.x label Nov 13, 2024
@justjhong justjhong merged commit 54ba452 into main Nov 13, 2024
11 of 12 checks passed
@justjhong justjhong deleted the jhong/decipher branch November 13, 2024 22:21
@ori-kron-wis ori-kron-wis added the on-merge: backport to 1.3.x on-merge: backport to 1.3.x label Dec 9, 2024
@ori-kron-wis ori-kron-wis added this to the scvi-tools 1.3 milestone Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cuda tests Run test suite on CUDA on-merge: backport to 1.3.x on-merge: backport to 1.3.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants